﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CodeTalk
{
    public partial class LibrarySelector : Form
    {
        public string SelectedItem { get; private set; }

        public void SetItems(string[] items)
        {
            libraryListBox.Items.Clear();
            libraryListBox.Items.AddRange(items);
        }

        public LibrarySelector()
        {
            InitializeComponent();
            SelectedItem = "";
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            if (libraryListBox.SelectedItem != null)
            {
                SelectedItem = (string)libraryListBox.SelectedItem;
            }
            else
            {
                SelectedItem = "";
            }
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            SelectedItem = "";
        }
    }
}
